package day14;

/**
 * @author oldliu
 * @since 1.0
 */
public class Circle {
    public static final double PI=3.1415926;
    public double r;
    public double x,y;
    //构造块，是个匿名构造方法，他会第一个执行
    {
        System.out.println("圆对象被构建了");
    }
    public Circle(){
        //System.out.println("圆对象被构建了");
        System.out.println("无参构造");
        r=0;
        x=y=0;
    }
    public Circle(double r){
        //System.out.println("圆对象被构建了");
        System.out.println("1参构造");
        this.r=r;
    }
    public Circle(double a,double b,double c){
        ///System.out.println("圆对象被构建了");
        System.out.println("3参构造");
        this.r=a;
        this.x=b;
        this.y=c;
    }
    public double getArea(){
        return 3.14*r*r;
    }

    @Override
    public String toString() {
        return "这是一个圆，半径是："+this.r;
    }
}
